package com.msz.util;


import java.io.Serializable;

/**
 * 缁熶竴json杩斿洖绫�
 * chain鐨勪腑鏂囧惈涔夋槸閾惧紡鐨勶紝璁剧疆涓簍rue锛屽垯setter鏂规硶杩斿洖褰撳墠瀵硅薄
 * @author hx
 * @date 2021-09-06 18:17
 */
public class R<T> implements Serializable {

    private static final long serialVersionUID = -4496007777208425865L;

    private Integer code;
    private String message;
    private T data;

    public R(){

    }
    /**
     * 鍝嶅簲缁撴灉
     * @param code 鎴愬姛鎸囦护
     * @param message  鎴愬姛娑堟伅
     * @return  RollResponse瀹炰緥
     */
    public static R result(Integer code, String message){
    	R r = new R<>(code, message);
    	return r;
    }

    /**
     * 鍝嶅簲缁撴灉
     * @param code 鎴愬姛鎸囦护
     * @param message 鎴愬姛娑堟伅
     * @param data  鎴愬姛鏁版嵁
     * @param <T>   娉涘瀷鏁版嵁
     * @return  RollResponse瀹炰緥
     */
    public static<T> R result(Integer code, String message,T data){
    	R r = new R<>(code,message,data);
    	return r;
    }
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}
	public R(Integer code, String message, T data) {
		super();
		this.code = code;
		this.message = message;
		this.data = data;
	}
	
	public R(Integer code, String message) {
		super();
		this.code = code;
		this.message = message;
	}
    
    



}
